<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>编辑</title>
		<link rel="stylesheet" type="text/css" href="../../plugins/layui/css/layui.css"/>
		<link href="../../kitAdmin/css/app.css" rel="stylesheet" type="text/css"/>
		<link rel="stylesheet" type="text/css" href="../../plugins/select2/dist/css/select2.min.css"/>
		<style type="text/css">
			/* .select2-container{
                display:none;
            } */

			.layui-unselect.layui-form-select {
				display: none;
			}
		</style>
	</head>

	<body>
		<div class='kit-table'>
			<div style='margin: 10px'>

				<form class='layui-form' action='' lay-filter='form-edit'>

					<input type='hidden' name='teacherId' data-link='{:teacherId}' />
					<input type='hidden' name='materialId' data-link='{:material}' />
					<input type='hidden' name='remainingHours' data-link='{:hoursRemaining}' />
					<input type='hidden' name='enrolledHours' data-link='{:hoursEnrolled}' />

					<div class='layui-form-item'>
							<label class='layui-form-label'>Student:</label>
							<div class='layui-input-inline' style="width:58%">
								<p data-link='{:studentName}' name='studentName' style="margin-top: 10px;word-wrap: break-word;margin-left: 86px;">
							</div>
					</div>
					<div class='layui-form-item'>
							<label class='layui-form-label'>Material:</label>
							<div class='layui-input-inline' style="width:58%">
								<p  data-link='{:materialName}' name='materialName' style="margin-top: 10px;word-wrap: break-word;margin-left: 86px;">
							</div>
					</div>

					<div class='layui-form-item'>
						<label class='layui-form-label'>Effort/Participation：</label>
						<div class='layui-input-inline' style="width:58%">
							<p  data-link='{:effortParticipation}' name='effortParticipation' style="margin-top: 10px;word-wrap: break-word;margin-left: 86px;">
						</div>
					</div>
					<div class='layui-form-item'>
						<label class='layui-form-label'>Behavior：</label>
						<div class='layui-input-inline' style="width:58%">
							<p  data-link='{:behavior}' name='behavior' style="margin-top: 10px;word-wrap: break-word;margin-left: 86px;">
						</div>
					</div>
			<div class='layui-form-item'>
				<label class='layui-form-label'>Improvement/Changes：</label>
			</div>
			<div class='layui-form-item'>
				<label class='layui-form-label'>A) Vocabulary：</label>

				<div class='layui-input-inline' style="width:58%">
					<p  data-link='{:vocabulary}' name='vocabulary' style="margin-top: 10px;word-wrap: break-word;margin-left: 86px;">
				</div>

				<div class='layui-form-item'>
					<label class='layui-form-label'>B) Grammar：</label>
					<div class='layui-input-inline' style="width:58%">
						<p  data-link='{:grammar}' name='grammar' style="margin-top: 10px;word-wrap: break-word;margin-left: 86px;">
					</div>
				</div>
			</div>
			<div class='layui-form-item'>
				<label class='layui-form-label'>C) Sentence Construction：</label>

				<div class='layui-input-inline' style="width:58%">
					<p  data-link='{:sentenceConstruction}' name='sentenceConstruction' style="margin-top: 10px;word-wrap: break-word;margin-left: 86px;">
				</div>
				<div class='layui-form-item'>
					<label class='layui-form-label'>D) Pronunciation：</label>

					<div class='layui-input-inline' style="width:58%">
						<p  data-link='{:pronunciation}' name='pronunciation' style="margin-top: 10px;word-wrap: break-word;margin-left: 86px;">
					</div>
				</div>
				
				<div class='layui-form-item'>
					<label class='layui-form-label'>E) Reading：</label>


					<div class='layui-input-inline' style="width:58%">
						<p  data-link='{:reading}' name='reading' style="margin-top: 10px;word-wrap: break-word;margin-left: 86px;">
					</div>
				</div>
			</div>
				</form>
			</div>
		</div>
		<script src="../../common/js/jquery.js" type="text/javascript" charset="utf-8"></script>
		<script src="../../static/js/base.js" type="text/javascript" charset="utf-8"></script>
		<script src="../../plugins/jsviews/jsviews.js" type="text/javascript"></script>
		<script src="../../plugins/select2/dist/js/select2.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="../../plugins/layui/layui.js" type="text/javascript" charset="utf-8"></script>
		<script type="text/javascript">
			var id = getQueryVariable('id');
			var type = getQueryVariable('type');
			jQuery(document).ready(function() {
                $("#_studentId").select2({
                    ajax: {
                        type: "get",
                        url: baseUrl + '/students/select5',
                        dataType: 'json',
                        delay: 250,
                        data: function (params) {
                            return {
                                key: params.term,
                            };
                        },
                        processResults: function (data) {
                            return {
                                results: data
                            };
                        },
                        cache: true
                    },
                    escapeMarkup: function (markup) {
                        return markup;
                    },
                    minimumInputLength: 1,
                    templateResult: function (data, container) {
                        var $result = $("<span></span>");
                        $result.text(data.showline);
                        return $result;
                    }
                });
				bindFormData();
                $("#_purchaseCourseId").select2({});

            });
			var callback_save = function() {
				return $('.layui-form').serialize();
			}

			function bindFormData() {
				var arr = [];
				$.ajax({
                    url: baseUrl + '/reportViews/type/' + id + "?type=Progress Report",
					type: 'get',
					async: false,
					success: function(datas) {
						console.log(datas);
						var data=datas.data;
						// $('#stuname').html(data.studentName);
						$.link(true, ".kit-table", data);
					}
				});
			}

			layui.use(['form', 'layedit', 'laydate'], function() {
				var form = layui.form,
					layer = layui.layer,
					layedit = layui.layedit,
					laydate = layui.laydate;
			})


            function testChange() {
                var stuId= $("#_studentId").val();
                if(stuId.length==0){
                    return;
                }
                $.ajax({
                    url: baseUrl + '/students/getCourse?studentId=' + stuId,
                    type: 'get',
                    async: false,
                    success: function (data) {
                        var htm = "";
                        data = data.data;
                        for (var i = 0; i < data.length; i++) {
                            htm += '<option value="' + data[i].id + '">' + data[i].text + '</option>';
                        }
                        $("#_purchaseCourseId").find("option:selected").text("");
                        $("#_purchaseCourseId").empty();

                        $('#_purchaseCourseId').append(htm);
                        form.render('select', 'materialLevel');
                        form.render('select');
                    },
                    error: function () {
                        parent.layer.alert('加载教师信息失败！');
                    }
                });
            }
		</script>
	</body>

</html>